Let str_utf8_to_ascii not crash if given NULL input.
authorrobertl <robertl>
Sun, 17 Oct 2004 01:20:02 +0000 (01:20 +0000)
committerrobertl <robertl>
Sun, 17 Oct 2004 01:20:02 +0000 (01:20 +0000)
util.c

diff --git a/util.c b/util.c
index 32d54baebcf97232343937c1465ae66a37183a65..975b7598fe83f955844d98c45086cc34c173aac1 100644 (file)
--- a/util.c
+++ b/util.c
@@ -785,8 +785,13 @@ char * str_utf8_to_cp1252( const char * str )
 
 char * str_utf8_to_ascii( const char * str )
 {
-       char *result = xstrdup( str );
-       char *cur = result;
+       char *result;
+       char *cur;
+
+       if (!str) return NULL;
+
+       result = xstrdup( str );
+       cur = result;
        
        while ( cur && *cur ) {
                if ( *cur & 0x80 ) {